<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <form id="dataForm" class="form-horizontal dataForm" action="/admin/train-management/update" method="post"
                      enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{{.data.Id}}">
                    <div class="box-body">
                        <div class="form-group">
                            <label for="title" class="col-sm-2 control-label">标题</label>
                            <div class="col-sm-10 col-md-4">
                                <input maxlength="50" class="form-control" id="title" placeholder="请给本次培训计划起个标题"
                                       name="title" value="{{.data.Title}}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="personInCharge" class="col-sm-2 control-label">负责人姓名</label>
                            <div class="col-sm-10 col-md-3">
                                <input maxlength="50" class="form-control" id="personInCharge"
                                       placeholder="此处请填写计划负责人或者你本人的姓名"
                                       name="personInCharge" value="{{.data.PersonInCharge}}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="registrationStartedAt" class="col-sm-2 control-label">报名开始时间</label>
                            <div class="col-sm-10 col-md-4">
                                <input type="datetime-local" id="registrationStartedAt" name="registrationStartedAt">
                            </div>
                        </div>
                        <script>
                            $('#registrationStartedAt').val('{{.data.RegistrationStartedAt.Format "2006-01-02T15:04" }}')
                        </script>

                        <div class="form-group">
                            <label for="registrationEndAt" class="col-sm-2 control-label">报名结束时间</label>
                            <div class="col-sm-10 col-md-4">
                                <input type="datetime-local" id="registrationEndAt" name="registrationEndAt" >
                            </div>
                        </div>
                        <script>
                            $('#registrationEndAt').val('{{.data.RegistrationEndAt.Format "2006-01-02T15:04" }}')
                        </script>


                        <div class="form-group">
                            <label for="status" class="col-sm-2 control-label">启用状态</label>
                            <div class="col-sm-10 col-md-4">
                                <input class="input-switch" id="status" value="1" {{if eq .data.Status 1}}checked {{end}} type="checkbox"/>
                                <input class="switch field-switch" name="status" value="{{.data.Status}}" hidden/>
                            </div>
                        </div>

                        <script>
                            $('#status').bootstrapSwitch({
                                onText: "是",
                                offText: "否",
                                onColor: "success",
                                offColor: "danger",
                                onSwitchChange: function (event, state) {
                                    $(event.target).closest('.bootstrap-switch').next().val(state ? '1' : '0').change();
                                }
                            });
                        </script>
                        </script>
                        <div class="form-group">
                            <label for="summary" class="col-sm-2 control-label">简介</label>
                            <div class="col-sm-10 col-md-10">
                                <script id="summary" name="summary" type="text/plain">
                                    {{str2html .data.Summary}}
                                </script>
                            </div>
                        </div>
                        <script>
                            UE.delEditor('summary');
                            var description = UE.getEditor('summary', {
                                serverUrl: UEServer
                            });
                        </script>
                    </div>
                    <a data-url="/admin/quota/index" data-confirm="2" data-type="2" data-id="{{.data.Id}}"
                       class="btn btn-default btn-xs AjaxButton" data-title="管理报名名额" title="点击打开管理面板"
                       data-toggle="tooltip">
                        <i class="fa fa-quora" aria-hidden="true"></i>管理各个高校报名名额
                    </a>
                    <!--表单底部-->
                    <div class="box-footer">
                        <div class="col-sm-2">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    保存
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="viewDialog" role="viewDialog" aria-hidden="true">
        <div class="modal-dialog modal-full">
            <div class="modal-content">
                <div class="modal-header" style="padding:10px !important;padding-bottom:5px;border-bottom:0px !important;">
                    <input type="button" value="上一张" onClick="javascript:maskprev(this)" style="margin-left:185px;">
                    <input type="button" value="下一张" onClick="javascript:masknext(this)" style="margin-left:60px;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
                </div>
                <div class="modal-body mask-layer-imgbox" style="padding-top:0px;text-align:center;"><!-- height:480px;width:600px -->

                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

</section>

<script>
    $("#dataForm").validate({
        rules: {
            nickname: {
                required: true,
                minlength: 2
            },
            username: {
                required: true,
                minlength: 2
            },
            password: {
                required: true,
                minlength: 6
            },
        },
        messages: {
            nickname: {
                required: "请输入昵称",
                minlength: "名称长度不能小于2"
            },
            username: {
                required: "请输入账号",
                minlength: "用户名长度不能小于2"
            },
            password: {
                required: "请输入密码",
                minlength: "密码长度不能小于6"
            },
        },

    });

    function viewFile() {

        $('#viewDialog').modal({
            backdrop:"static",
            keyboard:false,
            show: true
        });
    }

</script>

